//
//  StoreDetailNormalSectionHeader.m
//  BaseProject
//
//  Created by 王洋 on 2020/7/2.
//  Copyright © 2020 王洋. All rights reserved.
//

#import "StoreDetailNormalSectionHeader.h"

@interface StoreDetailNormalSectionHeader ()

@end

@implementation StoreDetailNormalSectionHeader
- (void)awakeFromNib {
    [super awakeFromNib];
    
}
- (instancetype)initWithCoder:(NSCoder *)coder {
    if (self = [super initWithCoder:coder]) {
        [self addSubview:self.moreButton];
        self.moreButton.right = self.width;
        self.moreButton.centerY = self.height * 0.5;
    }
    return self;
}
- (void)layoutSubviews {
    [super layoutSubviews];
    self.moreButton.right = self.width;
    self.moreButton.centerY = self.height * 0.5;
}
- (void)clickMoreButton:sender {
    !self.clickMoreButton ?: self.clickMoreButton();
}
#pragma mark - lazy
- (BaseAdjustButton *)moreButton {
    if (!_moreButton) {
        BaseAdjustButton *button = [BaseAdjustButton buttonWithType:UIButtonTypeCustom];
        [self addSubview:button];
        button.type = layoutTypeHorizontalLeftTitleRightImage;
        button.title = @"更多";
        button.fontWeight = UIFontWeightRegular;
        button.fontSize = 12;
        button.imageWidth = 14;
        button.imageHeight = 14;
        button.marginLeft = 12;
        button.marginItemX = 4;
        button.marginRight = 12;
        button.marginTop = 10;
        button.marginBottom = 10;
        [button begin];
        [button setTitle:@"更多" forState:UIControlStateNormal];
        [button setTitleColor:rgba(137, 137, 145, 1) forState:UIControlStateNormal];
        button.titleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightRegular];
        [button setImage:[UIImage imageNamed:@"arrow_right_14x14"] forState:UIControlStateNormal];
        [button addTarget:self action:@selector(clickMoreButton:) forControlEvents:UIControlEventTouchUpInside];
        button.hidden = YES;
        _moreButton = button;
    }
    return _moreButton;
}
@end
